﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="DefaultColorTheme.xaml"/>
	</ResourceDictionary.MergedDictionaries>

	<!-- Expander -->
	<Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Border Padding="{TemplateBinding Padding}" Margin="2,5">
						<Grid Background="Transparent" SnapsToDevicePixels="False">
							<Grid.RowDefinitions>
								<RowDefinition Height="19"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
							<Grid>
								<Grid.LayoutTransform>
									<TransformGroup>
										<TransformGroup.Children>
											<TransformCollection>
												<RotateTransform Angle="-90"/>
											</TransformCollection>
										</TransformGroup.Children>
									</TransformGroup>
								</Grid.LayoutTransform>
								<Ellipse x:Name="PART_Circle" HorizontalAlignment="Center" Height="19" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Width="19"/>
								<Path x:Name="PART_Arrow" Data="M 1,1.5L 4.5,5L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" VerticalAlignment="Center"/>
							</Grid>
							<ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Top"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="Data" TargetName="PART_Arrow" Value="M 1,4.5L 4.5,1L 8,4.5"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="StrokeThickness" TargetName="PART_Circle" Value="1.5"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Border Padding="{TemplateBinding Padding}" Margin="5,2">
						<Grid Background="Transparent" SnapsToDevicePixels="False">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="19"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
							<Grid>
								<Grid.LayoutTransform>
									<TransformGroup>
										<TransformGroup.Children>
											<TransformCollection>
												<RotateTransform Angle="180"/>
											</TransformCollection>
										</TransformGroup.Children>
									</TransformGroup>
								</Grid.LayoutTransform>
								<Ellipse x:Name="PART_Circle" HorizontalAlignment="Center" Height="19" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Width="19"/>
								<Path x:Name="PART_Arrow" Data="M 1,1.5L 4.5,5L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" VerticalAlignment="Center"/>
							</Grid>
							<ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="Data" TargetName="PART_Arrow" Value="M 1,4.5L 4.5,1L 8,4.5"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="StrokeThickness" TargetName="PART_Circle" Value="1.5"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Border Padding="{TemplateBinding Padding}" Margin="2,5">
						<Grid Background="Transparent" SnapsToDevicePixels="False">
							<Grid.RowDefinitions>
								<RowDefinition Height="19"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
							<Grid>
								<Grid.LayoutTransform>
									<TransformGroup>
										<TransformGroup.Children>
											<TransformCollection>
												<RotateTransform Angle="90"/>
											</TransformCollection>
										</TransformGroup.Children>
									</TransformGroup>
								</Grid.LayoutTransform>
								<Ellipse x:Name="PART_Circle" HorizontalAlignment="Center" Height="19" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Width="19"/>
								<Path x:Name="PART_Arrow" Data="M 1,1.5L 4.5,5L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" VerticalAlignment="Center"/>
							</Grid>
							<ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Top"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="Data" TargetName="PART_Arrow" Value="M 1,4.5L 4.5,1L 8,4.5"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="StrokeThickness" TargetName="PART_Circle" Value="1.5"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ExpanderHeaderFocusVisual">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate>
					<Border>
						<Rectangle Margin="0" SnapsToDevicePixels="True" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Border Padding="{TemplateBinding Padding}" Margin="5,2">
						<Grid Background="Transparent" SnapsToDevicePixels="False">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="19"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
							<Ellipse x:Name="PART_Circle" HorizontalAlignment="Center" Height="19" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Width="19"/>
							<Path x:Name="PART_Arrow" Data="M 1,1.5L 4.5,5L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" VerticalAlignment="Center"/>
							<ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="Data" TargetName="PART_Arrow" Value="M 1,4.5L 4.5,1L 8,4.5"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="StrokeThickness" TargetName="PART_Circle" Value="1.5"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="{x:Type Expander}">
		<Setter Property="Foreground" Value="{StaticResource ExpanderButtonForegroundBrush}"/>
		<Setter Property="Background" Value="{StaticResource ExpanderButtonBackgroundBrush}"/>
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
		<Setter Property="BorderBrush" Value="{StaticResource ExpanderButtonBackgroundBrush}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Expander}">
						<DockPanel>
							<Border x:Name="PART_HeaderSite" DockPanel.Dock="Top" Background="{TemplateBinding Background}"
									BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
								<ToggleButton x:Name="PART_ToggleButton" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
										  Content="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}"
										  FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}"
										  FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
										  IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="0" MinHeight="0"
										  Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Border>
							<ContentPresenter x:Name="PART_ExpandSite" DockPanel.Dock="Bottom" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
											  Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
						</DockPanel>
					<ControlTemplate.Triggers>
						<Trigger Property="IsExpanded" Value="True">
							<Setter Property="Visibility" TargetName="PART_ExpandSite" Value="Visible"/>
						</Trigger>
						<Trigger Property="ExpandDirection" Value="Right">
							<Setter Property="DockPanel.Dock" TargetName="PART_ExpandSite" Value="Right"/>
							<Setter Property="DockPanel.Dock" TargetName="PART_HeaderSite" Value="Left"/>
							<Setter Property="Style" TargetName="PART_ToggleButton" Value="{StaticResource ExpanderRightHeaderStyle}"/>
						</Trigger>
						<Trigger Property="ExpandDirection" Value="Up">
							<Setter Property="DockPanel.Dock" TargetName="PART_ExpandSite" Value="Top"/>
							<Setter Property="DockPanel.Dock" TargetName="PART_HeaderSite" Value="Bottom"/>
							<Setter Property="Style" TargetName="PART_ToggleButton" Value="{StaticResource ExpanderUpHeaderStyle}"/>
						</Trigger>
						<Trigger Property="ExpandDirection" Value="Left">
							<Setter Property="DockPanel.Dock" TargetName="PART_ExpandSite" Value="Left"/>
							<Setter Property="DockPanel.Dock" TargetName="PART_HeaderSite" Value="Right"/>
							<Setter Property="Style" TargetName="PART_ToggleButton" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="ExpandDirection" Value="Right"/>
								<Condition Property="IsExpanded" Value="False"/>
							</MultiTrigger.Conditions>
							<Setter Property="CornerRadius" TargetName="PART_HeaderSite" Value="0,2,2,0"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="ExpandDirection" Value="Up"/>
								<Condition Property="IsExpanded" Value="False"/>
							</MultiTrigger.Conditions>
							<Setter Property="CornerRadius" TargetName="PART_HeaderSite" Value="2,2,0,0"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="ExpandDirection" Value="Left"/>
								<Condition Property="IsExpanded" Value="False"/>
							</MultiTrigger.Conditions>
							<Setter Property="CornerRadius" TargetName="PART_HeaderSite" Value="2,0,0,2"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="ExpandDirection" Value="Down"/>
								<Condition Property="IsExpanded" Value="False"/>
							</MultiTrigger.Conditions>
							<Setter Property="CornerRadius" TargetName="PART_HeaderSite" Value="0,0,2,2"/>
						</MultiTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<!-- CheckBox -->
	<Style TargetType="{x:Type CheckBox}">
		<Setter Property="Foreground" Value="{StaticResource ButtonForegroundBrush}"/>
		<Setter Property="BorderBrush" Value="{StaticResource ButtonBorderBrush}"/>
		<Setter Property="Padding" Value="6,3"/>
	</Style>
	
	<!-- Button -->
	<Style TargetType="{x:Type Button}">
		<Setter Property="Foreground" Value="{StaticResource ButtonForegroundBrush}"/>
		<Setter Property="BorderBrush" Value="{StaticResource ButtonBorderBrush}"/>
		<Setter Property="Padding" Value="6,3"/>
	</Style>

	<!-- RepeatButton -->
	<Style x:Key="ScrollButtons" TargetType="{x:Type RepeatButton}">
		<Setter Property="Focusable" Value="false" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border Name="Border" Background="Transparent">
						<ContentPresenter Name="ContentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center"
										  Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
										  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- Thumb -->
	<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Grid Name="Grid">
						<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto"
								   Fill="Transparent" />
						<Rectangle Name="Rectangle1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="10"
								   Height="Auto" Fill="{TemplateBinding Background}" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="Tag" Value="Horizontal">
							<Setter TargetName="Rectangle1" Property="Width" Value="Auto" />
							<Setter TargetName="Rectangle1" Property="Height" Value="7" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- ScrollBar -->
	<Style TargetType="{x:Type ScrollBar}">
		<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
		<Setter Property="Foreground" Value="Red" />
		<Setter Property="Background" Value="#E0E0E0" />
		<Setter Property="Width" Value="12" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ScrollBar}">
					<Grid x:Name="GridRoot" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidth}}"
						  Background="{TemplateBinding Background}">
						<Grid.RowDefinitions>
							<RowDefinition MaxHeight="18" />
							<RowDefinition Height="0.00001*" />
							<RowDefinition MaxHeight="18" />
						</Grid.RowDefinitions>
						<RepeatButton x:Name="DecreaseRepeat" Command="ScrollBar.LineUpCommand" Style="{StaticResource ScrollButtons}"
									  Foreground="#BABABA">
							<Path x:Name="DecreaseArrow" Data="M 5,0L 0,6L 10,6 Z " HorizontalAlignment="Center"
								  VerticalAlignment="Center" Fill="{Binding ElementName=DecreaseRepeat, Path=Foreground}" />
						</RepeatButton>
						<Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="true" Focusable="false">
							<Track.Thumb>
								<Thumb x:Name="Thumb" Background="#BABABA" Style="{StaticResource ScrollThumbs}" />
							</Track.Thumb>
							<Track.IncreaseRepeatButton>
								<RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="false" />
							</Track.IncreaseRepeatButton>
							<Track.DecreaseRepeatButton>
								<RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="false" />
							</Track.DecreaseRepeatButton>
						</Track>
						<RepeatButton x:Name="IncreaseRepeat" Grid.Row="2" Command="ScrollBar.LineDownCommand" Style="{StaticResource ScrollButtons}"
									  Foreground="#BABABA">
							<Path x:Name="IncreaseArrow" Data="M 5,6L 10,0L 0,0 Z " Fill="{Binding ElementName=IncreaseRepeat, Path=Foreground}"
								  HorizontalAlignment="Center" VerticalAlignment="Center" />
						</RepeatButton>
					</Grid>

					<ControlTemplate.Triggers>
						<Trigger SourceName="IncreaseRepeat" Property="IsMouseOver" Value="true">
							<Setter Value="#A5A5A5" TargetName="IncreaseArrow" Property="Fill" />
						</Trigger>
						<Trigger SourceName="DecreaseRepeat" Property="IsMouseOver" Value="true">
							<Setter Value="#A5A5A5" TargetName="DecreaseArrow" Property="Fill" />
						</Trigger>
						<Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
							<Setter Value="#A5A5A5" TargetName="Thumb" Property="Background" />
						</Trigger>
						<Trigger SourceName="Thumb" Property="IsDragging" Value="true">
							<Setter Value="#959595" TargetName="Thumb" Property="Background" />
						</Trigger>
						<Trigger SourceName="IncreaseRepeat" Property="IsPressed" Value="true">
							<Setter Value="#959595" TargetName="IncreaseArrow" Property="Fill" />
						</Trigger>
						<Trigger SourceName="DecreaseRepeat" Property="IsPressed" Value="true">
							<Setter Value="#959595" TargetName="DecreaseArrow" Property="Fill" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Value="#BABABA" TargetName="IncreaseArrow" Property="Fill" />
							<Setter Value="#BABABA" TargetName="DecreaseArrow" Property="Fill" />
							<Setter TargetName="Thumb" Property="Visibility" Value="Collapsed" />
						</Trigger>
						<Trigger Property="Orientation" Value="Horizontal">
							<Setter TargetName="GridRoot" Property="LayoutTransform">
								<Setter.Value>
									<RotateTransform Angle="-90" />
								</Setter.Value>
							</Setter>
							<Setter TargetName="PART_Track" Property="LayoutTransform">
								<Setter.Value>
									<RotateTransform Angle="-90" />
								</Setter.Value>
							</Setter>
							<Setter Property="Width" Value="Auto" />
							<Setter Property="Height" Value="12" />
							<Setter TargetName="Thumb" Property="Tag" Value="Horizontal" />
							<Setter TargetName="DecreaseRepeat" Property="Command" Value="ScrollBar.LineLeftCommand" />
							<Setter TargetName="IncreaseRepeat" Property="Command" Value="ScrollBar.LineRightCommand" />
							<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
							<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<!-- TextBox -->
	<Style TargetType="{x:Type TextBox}">
		<Setter Property="Background" Value="{StaticResource TextBoxBackgroundBrush}"/>
		<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderBrush}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Foreground" Value="{StaticResource TextBoxForegroundBrush}"/>
		<Setter Property="CaretBrush" Value="{StaticResource TextBoxForegroundBrush}"/>
		<Setter Property="Padding" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type TextBox}">
					<Border x:Name="PART_Border" CornerRadius="0" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}"
						  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
						<ScrollViewer x:Name="PART_ContentHost" Margin="0"/>
					</Border>
					
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Background" Value="{StaticResource TextBoxDisabledBackgroundBrush}"/>
							<Setter Property="Foreground" Value="{StaticResource TextBoxDisabledForegroundBrush}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<!-- Label -->
	<Style TargetType="{x:Type Label}">
		<Setter Property="Foreground" Value="{StaticResource LabelForegroundBrush}"/>
	</Style>
</ResourceDictionary>